import Vue from 'vue'
import App from './App'

Vue.config.productionTip = false

App.mpType = 'app'

Vue.prototype.$domain = function() {
	let domain = "https://www.jiajiedaojia.com";
	return domain
};

Vue.prototype.$format = function (date,type) {
        //定义数组week:[日,一,二,三,四,五,六]
        var week=["日","一","二","三","四","五","六"];
        //获得date中的年y
        var y=date.getFullYear();
        //获得date中的月M，再+1
        var M=date.getMonth()+1;
        //如果M<10,就改为0+M；
        M<10&&(M="0"+M);
        //获得日d
        var d=date.getDate();
        //如果d<10,就该位0+d
        d<10&&(d="0"+d);
        //获得星期day
		var w = week[date.getDay()];
        //获得小时h
        var h=date.getHours()
        //如果h<10,就改为0+h
        h<10&&(h="0"+h);
        //获得分钟m
        var m=date.getMinutes();
        //获得分钟m<10，就改为0+m
        m<10&&(m="0"+m);

        var s = date.getSeconds();
        //获得分钟m<10，就改为0+m
        s<10&&(s="0"+s);

        return y + '-' + M+"-"+d + " " + "周" + w +" "+ h + ':' + m + ':' + s
};
Vue.prototype.$timestampToTime = function (timestamp) {
	var date = new Date(timestamp);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
	var Y = date.getFullYear() + '-';
	var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
	var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
	var h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
	var m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
	var s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
	
	let strDate = Y+M+D+h+m+s;
	return strDate;
	
};


const app = new Vue({
    ...App
})
app.$mount()
